package com.anolesoft.yr.mbus.prod.pack.mapper;

import com.anolesoft.yr.mbus.prod.pack.dto.ProdPackageServiceDeleteDTO;
import com.anolesoft.yr.mbus.prod.pack.dto.ProdPackageServiceSaveDTO;
import com.anolesoft.yr.mbus.prod.pack.dto.ProdPackageServiceUpdateDTO;
import com.anolesoft.yr.mbus.prod.pack.sql.ProdPackageServiceSQL;
import com.anolesoft.yr.mbus.prod.pack.vo.ProdPackageServiceQueryVO;
import com.anolesoft.yr.mbus.prod.pack.vo.ProdPackageServiceQueryVO2;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface ProdPackageServiceMapper {

    //新增服务项参数信息表
    @Insert(ProdPackageServiceSQL.SAVE_PROD_PACKAGE_SERVICE)
    int saveProdPackageService(ProdPackageServiceSaveDTO prodPackageServiceSaveDTO);

    //根据主键查询产品套餐服务项唯一数据
    @Select(ProdPackageServiceSQL.QUERY_PROD_PACKAGE_SERVICE_BY_UID)
    @Results(id = "queryProdPackageServiceByUid", value = {
        @Result(column = "objuid", property = "objuid"),
        @Result(column = "service_option_code", property = "updateServiceOptionCode"),
        @Result(column = "service_option_name", property = "updateServiceOptionName"),
        @Result(column = "value", property = "updateValue"),
        @Result(column = "is_default", property = "updateIsDefault"),
        @Result(column = "is_holiday", property = "updateIsHoliday"),
        @Result(column = "accept_time", property = "updateAcceptTime"),
        @Result(column = "reply_time", property = "updateReplyTime"),
        @Result(column = "delivery_time", property = "updateDeliveryTime"),
        @Result(column = "arrival_time", property = "updateArrivalTime"),
        @Result(column = "update_service_objuid", property = "updateServiceObjuid"),
        @Result(column = "update_service_value_objuid", property = "updateServiceValueObjuid"),
        @Result(column = "prod_package_service_objuid", property = "updateObjuid"),
        @Result(column = "prod_package_service_value_objuid", property = "updateObjuid2")
    })
    List<ProdPackageServiceQueryVO> queryProdPackageServiceByUid(String uid);

    //修改服务项参数信息表
    @Update(ProdPackageServiceSQL.UPDATE_PROD_PACKAGE_SERVICE)
    int updateProdPackageService(ProdPackageServiceUpdateDTO prodPackageServiceUpdateDTO);

    //删除服务项参数信息表
    @Delete(ProdPackageServiceSQL.DELETE_PROD_PACKAGE_SERVICE)
    int deleteProdPackageService(@Param("prodPackageUid") String prodPackageUid, @Param( "prodPackageServiceDeleteDTOList" ) List<ProdPackageServiceDeleteDTO> prodPackageServiceDeleteDTOList);

    //根据主键查询产品套餐服务项唯一数据
    @Select(ProdPackageServiceSQL.QUERY_PROD_PACKAGE_SERVICE_BY_UID2)
    @Results(id = "queryProdPackageServiceByUid2", value = {
            @Result(column = "objuid", property = "objuid"),
            @Result(column = "prod_service_objuid", property = "prodServiceObjuid"),
            @Result(column = "prod_service_uid", property = "prodServiceUid"),
            @Result(column = "service_option_code", property = "serviceOptionCode"),
            @Result(column = "service_option_name", property = "serviceOptionName"),
            @Result(column = "import_type", property = "importType")
    })
    List<ProdPackageServiceQueryVO2> queryProdPackageServiceByUid2(String uid);

}
